
(*
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$
$$$   PASCAL FILE NAME .................... PSAMPLE.TEXT
$$$   PASCAL FILE TYPE .................... TEXT
$$$   PASCAL FILE DATE .................... 1985-APR-11
$$$
$$$   PASCAL VOLUME NAME .................. MTXKIT
$$$
$$$   DISK IMAGE NAME ..................... A2PASDT3
$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$
$$$   DISK IMAGE COMMENT:
$$$
$$$     APPLE II PASCAL DESKTOP TOOLKIT - MOUSE TEXT - 1988 - 3/4
$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
*)

{$V-}                           { Do not check VAR parameters of type string }
program psample;
   {
   Sample program for the Pascal Interface to the MouseText Tool Kit 2.1
   }
   uses
      {$u mtxkit.code}
      mtxkit;
   const
      max_windows= 3;
      quit_menu= 1;
      file_menu= 2;
      edit_menu= 3;
      small_id= 1;
      big_id= 2;
      chars_id= 3;
      
      WinClear= 28;
      
   type
      smallline= packed array [0..25] of char;
      bigline= packed array [0..77] of char;
   
   var
      
      {Mouse driver communications data}
      ErrorCode
        : integer;
      
      MouseMode: record
         IntMode: integer;
         IntAddr: integer;
         end;
         
      RequestCode: packed record
         Direction: 0..1;
         Stat_Ctrl: 0..1;
         Reserved: 0..2047;
         Code: 0..7;
         end;
   
      ctlchange,    {controls changed}
      DoGoAway,     {clicked in goaway box}
      ItGrew,       {window grew}
      QuitSelected, {Quit the program?}
      thumbmoved,   {has the thumb moved?}
      use_interrupts{use the mouse in interrupt mode?}
        : boolean;
      
      space
        : char;
        
      column,
      dragx,
      dragy,
      linenumber,
      menu_choice,
      menu_id,
      MouseSlot,        {obtained by StartDeskTop}
      msavesize,        {size of menu save area}
      nextwindow,
      oldpos,
      screenx,
      screeny,
      thumbpos,
      topwindow,
      vislength,
      viswidth,
      windowid
        : integer;
      
      event
        : type_event;
      
      whicharea
        : type_area;
        
      whichctl
        : ctlarea;
        
      whichpart
        : ctlpart;
      
      {Menubar data structure}
      a_menubar
        : menu_bar;
      
      {Menu data structures}
      MData
        : array [1..max_menus] of menu_data;
      
      {Menubar titles}
      MTitle
        : array [1..max_menus] of title_str;
      
      {Quit menu items title}
      QuitItem
        : array [1..1] of item_str;
        
      {File menu item titles}
      FileItem
        : array [1..10] of item_str;
        
      {Edit menu item titles}
      EditItem
        : array [1..9] of item_str;
        
      {Menu save area: size of biggest menu
      (number of items+ 1)* (length(longest item string)+ 5)}
      msavearea
        : packed array [0..599] of char;
   
      WTitle
        : array [1..max_windows] of title_str;
        
      small_doc
        : array [0..4] of smallline;
        
      big_doc
        : array [0..19] of bigline;
    
      a_winfo
        : packed array [0..max_windows] of winfo;
        
      a_dinfo
        : packed array [0..2{max_windows}] of dinfo;
      
      a_string
        : string;
        
      item_num
        : array [0..max_windows] of integer;
        
   procedure SoundBell;
      begin { SoundBell }
         write(chr(7));
      end; { of SoundBell }
      
   procedure SetVis(windowid: integer);
      begin { SetVis }
         with a_winfo[windowid], a_dinfo[windowid] do
            begin
               viswidth:= contwidth- 2* ord(vscrollbar or growbox);
               vislength:= contlength- ord(hscrollbar= true);
            end; { with }
      end; { of SetVis }

   procedure Initialize;
      var
         menu_index,
         title_index
           : integer;
      
      procedure InitTitle;
         begin { InitTitle }
            with a_menubar.menus[menu_index] do
               begin
                  menu_id:= menu_index;
                  disabled:= 0;
                  pointer:= PointerTo(MTitle[menuindex]);
                  moveleft(pointer, title_ptr, 2);
                  pointer:= PointerTo(MData[menuindex]);
                  moveleft(pointer, m_data_ptr, 2);
               end; { with }
         end; { of InitTitle }
         
      procedure InitString;
         begin { InitString }
            
            WTitle[1]:= 'Small Window';
            WTitle[2]:= 'Big Window';
            WTitle[3]:= 'Mouse Chars';
            
            MTitle[1]:= 'Quit';
               QuitItem[1]:= 'Quit';
            
            MTitle[2]:= 'File';
               FileItem[1]:= 'Drag top window';
               FileItem[2]:= 'Grow top window';
               FileItem[3]:= 'Hide top window';
               FileItem[5]:= 'Open Small Window';
               FileItem[6]:= 'Open Big Window';
               FileItem[7]:= 'Open Mouse Chars Window';
            
            MTitle[3]:= 'Edit';
               EditItem[1]:= 'Undo';
               {Item 2 is filler}
               EditItem[3]:= 'Cut';
               EditItem[4]:= 'Copy';
               EditItem[5]:= 'Paste';
            
         end; { of InitString }
         
      procedure SetBigLine(doc_linenumber: integer; a_string: string);
         begin { SetBigLine }
            moveleft(a_string[1], big_doc[doc_linenumber], length(a_string));
         end; { of SetBigLine }
         
      procedure InitBig;
         
         { "Standard" fast file read. }
         
         const
            
            bufsize= 1024;
            bufmax= 1023;
         
         type
            
            strg255= string[255];
         
         var
         
            asciifile
              : file;
              
            NULL,
            RET
              : char;
            empty
              : boolean;
            firstnull,
            linenumber,
            startofline
              : integer;
            buffer
              : packed array[0..bufmax] of char;
         
         procedure fillbuffer;
            begin
               empty:= (blockread(asciifile, buffer, 2)= 0);
               if not empty then
                  begin
                     firstnull:=
                               bufsize+ scan(-bufsize, <> NULL, buffer[bufmax]);
                     startofline:= 0;
                  end; { if }
            end; { of fillbuffer }
            
         procedure readline(var line: strg255);
            var
               linelength
                 : integer;
            begin
               if startofline>= firstnull then
                  fillbuffer;
               if not empty then
                  begin
                     linelength:= scan(bufsize, =RET, buffer[startofline]);
                     {$R-}
                     line[0]:= chr(linelength);
                     {$R+}
                     if linelength> 0 then
                        moveleft(buffer[startofline], line[1], linelength);
                     startofline:= startofline+ linelength+ 1;
                  end; { if }
            end; { of readline }
      
         begin { InitBig }
            reset(asciifile, 'text');
            NULL:= chr(0);
            RET:= chr(13);
            startofline:= 0;
            firstnull:= 0;
            {note that line number 0 remains all spaces}
            linenumber:= 0;
            empty:= false;
            while not empty do
               begin
                  readline(a_string);
                  linenumber:= linenumber+ 1;
                  if a_string<> '' then
                     SetBigLine(linenumber, a_string);
               end; { while }
            close(asciifile);
         end; { of InitBig }
      
      procedure SetSmallLine(doc_linenumber: integer; a_string: string);
         begin { SetSmallLine }
            moveleft(a_string[1], small_doc[doc_linenumber], length(a_string));
         end; { of SetSmallLine }
         
      procedure InitSmall;
         begin { InitSmall }
            SetSmallLine(0, 'This is the contents');
            SetSmallLine(1, 'for a very small window;');
            SetSmallLine(2, 'This is just a test...');
            SetSmallLine(3, 'If this were an actual');
            SetSmallLine(4, 'emergency...');
         end; { of InitSmall }
         
   procedure NewWinfo(nextwindow: integer);
      begin { NewWinfo }
         a_winfo[nextwindow]:= a_winfo[0];
         with a_winfo[nextwindow] do
            begin
               window_id:= nextwindow;
               
               windowx:= 8* nextwindow;
               windowy:= 3+ nextwindow;
               
               if nextwindow<> chars_id then
                  with a_dinfo[nextwindow] do
                     begin
                      
                        pointer:= PointerTo(a_dinfo[nextwindow]);
                        moveleft(pointer, dinfoptr, 2);
                        
                        hthumbpos:= docx;
                        vthumbpos:= docy;
                     
                     end; { with }
      
             end; { with }
       
      end; { of NewWinfo }
      
      procedure InitWinfo;
         begin { InitWinfo }
            
            with a_winfo[0] do
               begin
                  
                  dinfo_or_user:= false;
                  growbox:= true;
                  goawaybox:= true;
                  dialog:= false;
                  
                  hscrollbar:= true;
                  hthumb:= true;
                  hactive:= true;
                  
                  vscrollbar:= true;
                  vthumb:= true;
                  vactive:= true;
                  
                  hthumbpos:= 0;
                  vthumbpos:= 0;
                  
               end; { with }
                
            NewWinfo(small_id);
            with a_winfo[small_id] do
               begin
                  pointer:= PointerTo(WTitle[small_id]);
                  moveleft(pointer, title_ptr, 2);
                  contwidth:= 24;
                  contlength:= 5;
                  mincontwidth:= 10;
                  maxcontwidth:= 26;
                  mincontlength:= 5;
                  maxcontlength:= 6;
                  
                  with a_dinfo[small_id] do
                     begin
                      
                        doc_ptr:= PointerTo(small_doc);
                        
                        docwidth:= 26;
                        doclength:= 5;
                     
                        SetVis(small_id);
                        hthumbmax:= docwidth- viswidth;
                        vthumbmax:= doclength- vislength;
                        
                     end; { with }
        
               end; { with }
                     
            NewWinfo(big_id);
            with a_winfo[big_id] do
               begin
                  pointer:= PointerTo(WTitle[big_id]);
                  moveleft(pointer, title_ptr, 2);
                  
                  contwidth:= 50;
                  contlength:= 10;
                  
                  mincontwidth:= 10;
                  maxcontwidth:= 80;
                  mincontlength:= 5;
                  maxcontlength:= 21;
                  
                  with a_dinfo[big_id] do
                     begin
                      
                        doc_ptr:= PointerTo(big_doc);
                        
                        docwidth:= 78;
                        doclength:= 20;
                     
                        SetVis(big_id);
                        hthumbmax:= docwidth- viswidth;
                        vthumbmax:= doclength- vislength;
                        
                     end; { with }
         
               end; { with }
            
            NewWinfo(chars_id);
            with a_winfo[chars_id] do
               begin
                  pointer:= PointerTo(WTitle[chars_id]);
                  moveleft(pointer, title_ptr, 2);
                  
                  dinfo_or_user:= true; {handle via updates}
                  growbox:= false;
                  contwidth:= 17;
                  contlength:= 9;
                  
                  mincontwidth:= contwidth;
                  maxcontwidth:= contwidth;
                  mincontlength:= contlength;
                  maxcontlength:= contlength;
                  
                  hscrollbar:= false;
                  vscrollbar:= false;
                  
                  {no dinfo for MouseChars window; update events are used}
               
               end; { with }
            
         end; { of InitWinfo }

      begin { Initialize }
         space:= ' ';
         
         nextwindow:= 0;
         windowid:= 0;
         
         fillchar(whicharea, sizeof(whicharea), 0);
         fillchar(a_menubar, sizeof(a_menubar), 0);
         fillchar(MData, sizeof(MData), 0);
         fillchar(MTitle, sizeof(MTitle), 0);
         fillchar(WTitle, sizeof(WTitle), 0);
         fillchar(QuitItem, sizeof(QuitItem), 0);
         fillchar(FileItem, sizeof(FileItem), 0);
         fillchar(EditItem, sizeof(EditItem), 0);
         fillchar(a_winfo, sizeof(a_winfo), 0);
         fillchar(item_num, sizeof(item_num), 0);
         fillchar(a_dinfo, sizeof(a_dinfo), 0);
         fillchar(small_doc, sizeof(small_doc), space);
         fillchar(big_doc, sizeof(big_doc), space);
         
         InitWinfo;
         InitSmall;
         InitBig;
         {mouse chars window is drawn at update events}
         InitString;
         
         with a_menubar do
            begin
               {Set menu titles and data pointers}
               num_menus:= 3;
               for menu_index:= 1 to num_menus do
                  InitTitle;
               
               {Quit menu}
               with MData[quit_menu] do
                  begin
                     num_items:= 1;
                     {point to QuitItem string}
                     pointer:= PointerTo(QuitItem[1]);
                     moveleft(pointer, items[1].item_str_ptr, 2);
                     
                     {line 1 has a menu key}
                     with items[1] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('Q');
                           char2:= ord('q');
                        end; { with }
                     
                  end; { with }
               
               {File menu}
               with MData[file_menu] do
                  begin
                     num_items:= 7;
                     {point to FileItem strings}
                     for title_index:= 1 to num_items do
                        begin
                           pointer:= PointerTo(FileItem[title_index]);
                           moveleft(pointer, items[title_index].item_str_ptr,
                                    2);
                        end; { for }
                     
                     {line 4 is filler}
                     with items[4] do
                        begin
                           item_is_filler:= true;
                           item_str_ptr:= nil;
                           char1:= 19; { horizontal line }
                        end; { with }
                  
                     {line 1 has a menu key}
                     with items[1] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('D');
                           char2:= ord('d');
                        end; { with }
                     
                     {line 2 has a menu key}
                     with items[2] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('G');
                           char2:= ord('g');
                        end; { with }
                     
                     {line 3 has a menu key}
                     with items[3] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('H');
                           char2:= ord('h');
                        end; { with }
                     
                  end; { with }
                     
               {Edit menu}
               with MData[edit_menu] do
                  begin
                     num_items:= 5;
                     {Point to EditItem strings}
                     for title_index:= 1 to num_items do
                        begin
                           pointer:= PointerTo(EditItem[title_index]);
                           moveleft(pointer, items[title_index].item_str_ptr,
                                    2);
                        end; { for }
                     
                     {line 2 is filler}
                     with items[2] do
                        begin
                           item_is_filler:= true;
                           item_str_ptr:= nil;
                           char1:= 19; { horizontal line }
                        end; { with }
                  
                     {line 3 has a menu key}
                     with items[3] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('X');
                           char2:= ord('x');
                        end; { with }
                     
                     {line 4 has a menu key}
                     with items[4] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('C');
                           char2:= ord('c');
                        end; { with }
                     
                     {line 5 has a menu key}
                     with items[5] do
                        begin
                           solid_apple:= true;
                           open_apple:= true;
                           char1:= ord('V');
                           char2:= ord('v');
                        end; { with }
                     
                  end; { with }
               
            end; { with }
      end; { of Initialize }
      
    procedure InitMouseDriver;
       begin { InitMouseDriver }
         {Start with the mouse off}
         UnitClear(129);
         ErrorCode:= IOResult;
         if ErrorCode<> 0 then
            begin
               if ErrorCode= 9 then
                  writeln('No mouse card installed.')
               else
                  writeln('UnitClear error: ', ErrorCode);
               exit(psample);
            end; { if }
      
         {Set the attach driver's interrupt address:
          UnitStatus Control code 0.}
         with RequestCode do
            begin
               Direction:= 0;
               Stat_Ctrl:= 1;
               Code:= 0;
            end; { with }
         with MouseMode do
            begin
               IntMode:= 0; { passive mode for now; if interrupts are
                              required, StartDeskTop will enable them }
               PascIntAdr(IntAddr);
            end; { with }
         UnitStatus(129, MouseMode, RequestCode);
         ErrorCode:= IOResult;
         if ErrorCode<> 0 then
            begin
               WriteLn('SetMouse error: ', ErrorCode);
               exit(psample);
            end; { if }
      end; { of InitMouseDriver }
      
   procedure InitDeskTop;
   
     var sid: integer;
   
      function is2e: boolean;
      type bitarray=packed array[0..7] of boolean;
           addr=    record case boolean of
                      false:(int: integer);
                      true: (ptr:^bitarray);
                    end;
      var  a: addr;
      begin
        a.int:= -16591;                  { $BF31 }
        is2e:= (a.ptr^[7]) AND (NOT a.ptr^[6]);
      end; { is2e }
      
      begin { InitDeskTop }
         
         {Hide the Pascal text cursor}
         GoToXY(0, 0);
         
         MouseSlot:= 0;
         use_interrupts:= true;
         if is2e then sid:=234 else sid:=0;
         StartDeskTop(6, sid,         {Apple //c, Apple //e}
                      MouseSlot,      {search slots for the mouse}
                      use_interrupts, {passive= false; interrupts= true}
                      true );         {80 columns}
         
         SetKeyEvent(true);
         
         FlushEvents;
      
      end; { of InitDeskTop }
      
   procedure MenuStart;
      begin { MenuStart }
         
         pointer:= pointerto(msavearea);
         msavesize:= sizeof(msavearea);
         
         InitMenu(pointer, msavesize);
         InitWindowMgr(pointer, msavesize);
         
         SetMenu(a_menubar);
         
         ShowCursor;
         
      end; { of MenuStart }
      
   procedure ShowChars;
      var
         base,
         doclinenumber,
         temp
           : integer;
      begin { ShowChars }
         WinOp( chars_id, 0, 0, WinClear);
         
         doclinenumber:= 1;
         {base character value for the current line}
         base:= 0;
         repeat
            for temp:= 0 to 7 do
                WinChar(chars_id, 2* temp+ 1, doclinenumber, chr(base+ temp));
            doclinenumber:= doclinenumber+ 2;
            base:= base+ 8;
         until base> 31;
      end; { of ShowChars }
         
   procedure doHelp;
      begin { doHelp }
         HiliteMenu(0);
      end; { of doHelp }
      
   procedure NewWindow(nextwindow: integer);
      begin { NewWindow }
         DisableItem(menu_id, menu_choice, true);
         OpenWindow(a_winfo[nextwindow]);
         
         item_num[nextwindow]:= menu_choice;
         if nextwindow<> chars_id then
            SetVis(nextwindow);
      end; { of NewWindow }
      
   procedure docwindow(scrollby: integer);
      procedure fixcoord(var doccoord: integer; vissize, maxsize: integer);
         begin { fixcoord }
            thumbpos:= doccoord;
            doccoord:= doccoord+ scrollby;
            if doccoord< 0 then
               doccoord:= 0;
            if doccoord> maxsize- vissize then
               doccoord:= maxsize- vissize;
            ctlchange:= thumbpos<> doccoord;
            thumbpos:= doccoord;
         end; { of fixcoord }
         
      begin { docwindow }
         with a_winfo[windowid], a_dinfo[windowid] do
            begin
               if whichctl= verscroll then
                  fixcoord(docy, vislength, doclength)
               else
                  fixcoord(docx, viswidth, docwidth);
            end; { if }
      end; { of docwindow }
   
   procedure doGrow;
      begin { doGrow }
         with a_winfo[windowid], a_dinfo[windowid] do
            begin
               whichctl:= verscroll;
               SetVis(windowid);
               docwindow(0);
               SetCtlMax(whichctl, doclength- vislength);
               UpdateThumb(whichctl, thumbpos);
               whichctl:= horscroll;
               docwindow(0);
               SetCtlMax(whichctl, docwidth- viswidth);
               UpdateThumb(whichctl, thumbpos);
               WinBlock(windowid,
                        a_dinfo[windowid], 0, 0, viswidth- 1, vislength- 1);
               ActivateCtl(horscroll, contwidth< maxcontwidth);
               ActivateCtl(verscroll, contlength< maxcontlength);
            end; { with }
      end; { of doGrow }
   
procedure scroll(numlines: integer);
   begin { scroll }
      with a_winfo[windowid] do
         repeat
            docwindow(numlines);
            if ctlchange then
               WinBlock(windowid, a_dinfo[windowid], 0, 0,
                        viswidth- 1, vislength- 1);
            UpdateThumb(whichctl, thumbpos);
            ctlchange:= false;
            GetEvent(event);
         until event.evt_kind in [button_up, no_event];
   end; { of scroll }
   
procedure GetCtl;
   begin { GetCtl }
      with event do
         ScreenToWindow(windowid, char1, char2, column, linenumber);
      FindControl(column, linenumber, whichctl, whichpart);
   end; { of GetCtl }
   
procedure TestContent;
   { Click in content region of top window;
     This would probably be a 'Case windowid of' procedure }
   begin { TestContent }
      GetCtl;
      if whichctl in [verscroll, horscroll] then
         with a_winfo[windowid] do
            begin
               ctlchange:= false;
               case whichpart of
                  scrollupleft: scroll(-1);
               scrolldownright: scroll(1);
                    pageupleft: if whichctl= verscroll then
                                   scroll(2- vislength)
                                else
                                   scroll(2- viswidth);
                 pagedownright: if whichctl= verscroll then
                                   scroll(vislength- 2)
                                else
                                   scroll(viswidth- 2);
                         thumb: begin
                                   if whichctl= verscroll then
                                      oldpos:= vthumbpos
                                   else
                                      oldpos:= hthumbpos;
                                   TrackThumb(whichctl, thumbpos, thumbmoved);
                                   docwindow(thumbpos- oldpos);
                                end; { case thumb }
                           end; { case }
               if ctlchange then
                  WinBlock(windowid, a_dinfo[windowid], 0, 0,
                           viswidth- 1, vislength- 1);
               UpdateThumb(whichctl, thumbpos);
            end; { if }
   end; { of TestContent }
      
   procedure MakeFront;
      begin { MakeFront }
         FrontWindow(topwindow);
         if topwindow<> windowid then
            begin
               SelectWindow(windowid);
               if windowid<> chars_id then
                  SetVis(windowid);
               topwindow:= windowid;
            end
         else
            if whicharea= inContent then
               TestContent;
      end; { of MakeFront }
 
procedure doQuit;
   begin { doQuit }
      QuitSelected:= true;
      HiliteMenu(0);
   end; { of doQuit }
   
procedure doFile;
   begin { doFile }
      case menu_choice of
         1: {Drag front window}
            begin
               FrontWindow(windowid);
               KeybdMouse;
               DragWindow(windowid, 0, 2);
               MakeFront;
            end; { if }
         2: {Grow front window}
            begin
               FrontWindow(windowid);
               KeybdMouse;
               GrowWindow(ItGrew);
               if ItGrew then
                  doGrow;
            end; { if }
         3: {Hide front window}
            begin
               FrontWindow(windowid);
               CloseWindow(windowid);
               DisableItem(file_menu,item_num[windowid], false);
            end; { case 3 }
     5,6,7: NewWindow(menu_choice- 4);
         end; { case }
      HiliteMenu(0);
   end; { of doFile }
      
procedure doEdit;
   begin { doEdit }
      HiliteMenu(0);
   end; { of doQuit }
   
procedure doMenu;
  begin { doMenu }
     case menu_id of
        quit_menu: doQuit;
        file_menu: doFile;
        edit_menu: doEdit;
        end; { case }
  end; { of doMenu }

   procedure HandleMenu;
      begin { HandleMenu }
         with event do
            begin
               FindWindow(char1, char2, whicharea, windowid);
               case whicharea of
                  inMenubar: begin
                                MenuSelect(menu_id, menu_choice);
                                doMenu;
                             end; { case inMenubar }
                     inDrag: begin
                                DragWindow(windowid, char1, char2);
                                MakeFront;
                             end; { case inDrag }
                     inGrow: begin
                                GrowWindow(ItGrew);
                                if ItGrew then
                                   DoGrow;
                             end; { case inGrow }
                   inGoAway: begin
                                TrackGoAway(DoGoAway);
                                if DoGoAway then
                                   begin
                                      CloseWindow(windowid);
                                      DisableItem(file_menu,
                                                  item_num[windowid], false);
                                   end; { if }
                             end; { case inGoAway }
                  inContent: MakeFront;
                        end; { case }
         end; { with }
   end; { of HandleMenu }
   
begin { psample }
   Initialize;
   InitMouseDriver;
   InitDeskTop;
   MenuStart;
   QuitSelected:= false;
   Repeat
      GetEvent(event);
      if event.evt_kind= button_down then
         HandleMenu
      else
         if event.evt_kind= update_evt then
            begin
               if event.char1= chars_id then
                  ShowChars;
            end
         else
           if event.evt_kind= key_down then
              begin
                 MenuKey(menu_id, menu_choice, event);
                 if menu_id<> 0 then
                    doMenu;
              end; { if }
   Until QuitSelected;
   CloseAll;
   writeln;
   Version(windowid, menuid);
   writeln('Version ', windowid, '.', menuid, '; MemAvail: ', MemAvail);
   StopDeskTop;
end. { of psample }


(*
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$   END OF FILE : MTXKIT - PSAMPLE.TEXT
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

File brought to you by:

Apple Macintosh Apple II Pascal Disk Image Dumper 1.0.0 (16 May 2004)
David T Craig (Santa Fe, New Mexico, USA)
shirlgato@cybermesa.com / dcraig@cyberwolf.com

Sunday, June 20, 2004 -- 1:51:59 PM
*)

